<template>
  <el-dialog
    title="佣金日志详情"
    :visible.sync="dialogVisible"
    width="350px"
    top="40%">
    <div id="commission-detail-dialog" v-if="detail.shopId>0">
      <div class="title">
        店铺信息
      </div>
      <div class="tmp-shop-box"  @click="shopDetail">
        <div class="logo">
          <img :src="detail.shopLogo"/>
        </div>
        <div class="name" v-text="detail.shopName"></div>
        <div class="go-to-button">
          <i class="el-icon el-icon-arrow-right"></i>
        </div>
        <div class="c"></div>
      </div>

      <div class="title">
        会员信息
      </div>
      <div class="tmp-shop-box"  @click="$router.push('/ShopHome?id='+detail.shopId)">
        <div class="logo">
          <img :src="detail.memberIcon"/>
        </div>
        <div class="name" v-text="detail.memberNickname"></div>
        <div class="c"></div>
      </div>

      <div class="title">
        采购单
      </div>
      <div style="padding: 5px; background: #f1f1f1; height: 40px; line-height: 40px; border-radius: 4px;" @click="shopProductPurchaseDetial">
        <el-col :span="10">商品数量: <span class="red" v-text="detail.shopProductPurchaseNums"></span></el-col>
        <el-col :span="10">采购单金额: <span class="red" v-text="ToMoney(detail.shopProductPurchaseMoney)"></span></el-col>
        <el-col :span="4" align="center">
          <i class="el-icon el-icon-arrow-right"></i>
        </el-col>
      </div>
    </div>
  </el-dialog>

</template>

<script>
export default {
  name: 'CommissionDetailDialog',
  data: function () {
    return {
      dialogVisible: false,
      detail: {
        shopId:0
      }
    }
  },
  mounted () {
    let $this = this
    $this.bus.$on('CommissionDetailDialogCallBus', function (id) {
      $this.dialogVisible = true
      $this.getDetail(id)
      $this.$forceUpdate()
    })

  },
  methods: {
    getDetail:function (id) {
      let $this = this
      $this.MyRequest($this.ApiDoNameShop + 'Member/getCommissionLogDetail', {id}, function (data) {
        $this.detail=data
        console.log('$this.detail',$this.detail)
        $this.$forceUpdate()
      }, function (msg) {
        $this.$message.error(msg)
      })
    },
    shopDetail:function () {
      this.dialogVisible=false
      this.$router.push('/ShopHome?id='+this.detail.shopId)
    },
    shopProductPurchaseDetial(){
      this.dialogVisible=false
      this.$router.push('/ShopProductPurchaseDetail?id='+this.detail.shopProductPurchaseId)
    }
  }
}
</script>

<style scoped>

</style>
